package com.hydra.wiki.quartz.adapter;

import javax.servlet.ServletContext;

import com.hydra.wiki.quartz.server.FarmQzSchedulerManagerInter;
import com.hydra.wiki.util.spring.BeanFactory;
import com.hydra.wiki.web.task.ServletInitJobInter;
import lombok.extern.log4j.Log4j;
import org.springframework.stereotype.Component;

@Log4j
@Component
public class StartSysTask implements ServletInitJobInter {

    @Override
    public void execute(ServletContext context) {
        FarmQzSchedulerManagerInter aloneIMP = (FarmQzSchedulerManagerInter) BeanFactory
                .getBean("farmQzSchedulerManagerImpl");
        try {
            aloneIMP.start();
            log.info("started '任务调度'");
        } catch (Exception e) {
            log.error("Error!", e);
        }
    }

}
